﻿package com.gengine.keyBoard
{

    public class KeyData extends Object
    {
        public var key:int;
        public var isKeyDown:Boolean = false;
        public var keyCode:uint;
        private var _keyMap:IKeyMap;
        private var _isShift:Boolean;
        private var _isCtrl:Boolean;
        private var _shortcutsName:String;

        public function KeyData(param1:uint = 0, param2:Boolean = false, param3:Boolean = false)
        {
            this.keyCode = param1;
            this._isShift = param2;
            this._isCtrl = param3;
            this.updateKey(param1, this._isShift, this._isCtrl);
            return;
        }// end function

        public function get keyMap() : IKeyMap
        {
            return this._keyMap;
        }// end function

        public function set keyMap(param1:IKeyMap) : void
        {
            this._keyMap = param1;
            return;
        }// end function

        public function get isShift() : Boolean
        {
            return this._isShift;
        }// end function

        public function set isShift(param1:Boolean) : void
        {
            this._isShift = param1;
            return;
        }// end function

        public function get isCtrl() : Boolean
        {
            return this._isCtrl;
        }// end function

        public function set isCtrl(param1:Boolean) : void
        {
            this._isCtrl = param1;
            return;
        }// end function

        public function get shortcutsName() : String
        {
            return this._shortcutsName;
        }// end function

        private function updateKey(param1:int, param2:Boolean, param3:Boolean) : void
        {
            this.keyCode = param1;
            this._isShift = param2;
            this._isCtrl = param3;
            if (this._isShift)
            {
                this.key = param1 + KeyCode.SHIFT_NUM;
            }
            else if (this._isCtrl)
            {
                this.key = param1 + KeyCode.CTRL;
            }
            else
            {
                this.key = param1;
            }
            if (this._isShift)
            {
                this._shortcutsName = "sh" + KeyCode.getKeyName(this.keyCode);
            }
            else if (this._isCtrl)
            {
                this._shortcutsName = "ct" + KeyCode.getKeyName(this.keyCode);
            }
            else
            {
                this._shortcutsName = KeyCode.getKeyName(this.keyCode);
                if (this._shortcutsName == null)
                {
                    this._shortcutsName = "";
                }
            }
            return;
        }// end function

    }
}
